<template>
    <Layout>
        <Form ref="form1" :model="form1" :label-width="120">
            <Row class="query-form">
                <Col span="8" v-if="!modelSelect">
                    <FormItem label="二级集团：">
                        <two-level-org org-code class="query-form-el" v-model="form1.twoLevelOrgCode" />
                    </FormItem>
                </Col>
                <Col span="8" v-if="!modelSelect">
                    <FormItem label="单位名称：" prop="companyId">
                        <company-select v-model="form1.companyName" style="width:100%" />
                        <!-- <cascader-dom ref="childOrg" @setOrgInfo="setOrgId" @setOrgname="setOrgName" :rootOrgId="currentUser.companyId"
                                      :orgTree="true" :setCurrentName="{label:form1.companyName,value:form1.companyId}"></cascader-dom> -->
                    </FormItem>
                </Col>
                <Col span="8" v-if="modelSelect">
                    <FormItem label="相关方名称：">
                        <Input type="text" v-model="form1.contractorName"/>
                    </FormItem>
                </Col>
                <Col span="8" v-if="modelSelect">
                    <FormItem label="类别：">
                        <Select v-model='form1.category' placeholder="请选择类别" clearable>
                            <Option v-for="item in categorys" :value="item.codingCodeId" :key="item.codingCodeId">{{item.codingName }}
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span="8" v-if="!switchFlag">
                    <Button @click="switchQuery(true)" v-if="!modelSelect" class="ivu-btn-switch" type="text">展开∨</Button>
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button icon="md-search" class="ivu-btn-query" @click="query1()">查询</Button>
                </Col>
                <Col span="8" v-else>
                    <FormItem label="类别：">
                        <Select v-model='form1.category' placeholder="请选择类别" clearable >
                            <Option v-for="item in categorys" :value="item.codingCodeId" :key="item.codingCodeId">{{item.codingName }}
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
            </Row>
            <Row v-show="switchFlag" class="query-form">
                <Col span="8">
                    <FormItem label="相关方名称：">
                        <Input type="text" v-model="form1.contractorName"/>
                    </FormItem>
                </Col>
                <Col span='8'>
                    <FormItem label='合作期限：' prop="cooperationTerm">
                        <Select v-model='form1.cooperationTerm' placeholder="请选择合作期限" clearable>
                            <Option v-for="item in cooperationTerms" :value="item" :key="item">{{item }}
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span="8">
                    <Button @click="switchQuery(false)" class="ivu-btn-switch" type="text">收起∧</Button>
                    <Button @click="reset" class="ivu-btn-reset">重置</Button>
                    <Button class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
                </Col>
            </Row>
            <Row class="query-form" v-if="!modelSelect">
                <Col span="24">
                    <Button size="large" class="ivu-btn-add" icon="md-add" @click="addInfo">新增</Button>
                    <download-button :api="exportUrl" :queryForm='form1' />
                </Col>
            </Row>
        </Form>
        <Table ref='table' :height="tableHeight" :loading="loading" size="small" class="table" no-data-text="没有查询到相关数据!"
               highlight-row stripe border :columns="columns1" width="100%" :data="dataTable">
        </Table>
        <Row style="margin-right:10px;">
            <Col span="24">
                <Page :total="pagedata.total" :page-size="pagedata.pageSize" @on-change="pageChange"
                      style="float: right" @on-page-size-change="pageSizeChange" :page-size-opts="pageSizeArray"
                      show-total show-sizer show-elevator/>
            </Col>
        </Row>

        <Modal :transfer=false v-model="model1" :width=800 :mask-closable="false" @on-cancel="onCancel">
            <p>
                <span>相关方基本信息</span>
            </p>
            <div>
                <!--<Menu mode="horizontal" @on-select='lowerStep' :active-name="modaleshow">-->
                    <!--<MenuItem :name="1">相关方基本信息</MenuItem>-->
                    <!--<MenuItem :name="2">人员信息</MenuItem>-->
                    <!--<MenuItem :name="3">人员资质证书</MenuItem>-->
                    <!--<MenuItem :name="4">安全环保协议</MenuItem>-->
                    <!--<MenuItem :name="5">其它</MenuItem>-->
                <!--</Menu>-->
                <Form ref='InputData' :model="InputData" :rules="ruleCustom" label-position="top">
                    <!--:label-width="120"-->
                    <div v-show="modaleshow==1">
                        <br/>
                        <Row style="line-height: 28px;margin-left: 10px">
                            <Col span="23">
                                <FormItem label='单位名称：' prop='companyId'>
                                    <cascader-dom v-if="show" ref='orgCascader' @setOrgInfo='setCompanyId' @setOrgname="setCompanyName" :orgTree="true" :currentOrgId = "InputData.companyId"
                                                  :setCurrentName="{label:InputData.companyName,value:InputData.companyId}" ></cascader-dom>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row style="line-height: 28px;margin-left: 10px">
                            <Col span='11'>
                                <FormItem label='相关方名称：' prop="accountId">
                                    <Input v-model="InputData.contractorName" readonly @on-focus="isTrueModel2"/>
                                </FormItem>
                            </Col>
                            <Col span='11' offset="1">
                                <FormItem label='类别：' prop="category">
                                    <!--<Input v-model="InputData.category" />-->
                                    <Select v-model='InputData.category' placeholder="请选择类别" >
                                        <Option v-for="item in categorys" :value="item.codingCodeId" :key="item.codingCodeId">{{item.codingName }}
                                        </Option>
                                    </Select>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row style="line-height: 28px;margin-left: 10px">
                                <Col span='11' >
                                    <FormItem label='法定代表人：'>
                                        <Input v-model="InputData.legalPerson " readonly/>
                                    </FormItem>
                                </Col>
                            <!-- <Col span='11' offset="1">
                                <FormItem label='特种作业人员上岗证数量：' prop="workLicenseNumber">
                                    <InputNumber style="width:100%" :min="0"
                                                 v-model="InputData.workLicenseNumber"></InputNumber>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row style="line-height: 28px;margin-left: 10px">
                            <Col span='11'>
                                <FormItem label='特种作业人员数量：' prop="workerNumber">
                                    <InputNumber style="width:100%" :min="0"
                                                 v-model="InputData.workerNumber"></InputNumber>
                                </FormItem>
                            </Col> -->
                            <Col span='11' offset="1">
                                <FormItem label='相关方负责人：' prop="constructionDirector">
                                    <Input v-model="InputData.constructionDirector"/>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row style="line-height: 28px;margin-left: 10px">
                            <Col span='11'>
                                <FormItem label='相关方负责人电话：' prop="constructionDirectorPhone">
                                    <Input v-model="InputData.constructionDirectorPhone"/>
                                </FormItem>
                            </Col>
                            <Col span='11' offset="1">
                                <FormItem label='相关方单位安全员：' prop="safetyOfficer">
                                    <Input v-model="InputData.safetyOfficer"/>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row style="line-height: 28px;margin-left: 10px">
                            <Col span='11'>
                                <FormItem label='相关方单位安全员电话：' prop="safetyOfficerPhone">
                                    <Input v-model="InputData.safetyOfficerPhone"/>
                                </FormItem>
                            </Col>
                            <Col span='11' offset="1">
                                <FormItem label='合作期限：' prop="cooperationTerm">
                                    <!--<Input v-model="InputData.category" />-->
                                    <Select v-model='InputData.cooperationTerm' placeholder="请选择合作期限" >
                                        <Option v-for="item in cooperationTerms" :value="item" :key="item">{{item }}
                                        </Option>
                                    </Select>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row style="line-height: 28px;margin-left: 10px">
                            <Col span="23">
                                <FormItem label="资质文件：">
                                    <Upload ref="upload"
                                            :before-upload="beforeUpload"
                                            :show-upload-list="true"
                                            :max-size="10240"
                                            multiple
                                            type="drag"
                                            :action="fileUrl+'/'+InputData.bookId+'/files/userFile/certificate'">
                                        <div style="padding: 20px">
                                            <Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
                                            <p>点击将文件拖拽到这里上传</p>
                                            <span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>
                                        </div>
                                    </Upload>
                                </FormItem>
                                <FormItem label="资质文件：" v-show="uploadList5.length>0">
                                    <div v-for="item in uploadList5" :key='item'>
                                        <a @click="downloadFile(InputData.bookId,item)">{{ item.fileName }}</a>
                                        <Button type="text" icon="md-trash" @click="remove1(item.id,modaleshow)"
                                                style="margin-left: 5px;margin-bottom: 3px"/>
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>
                        <Row style="line-height: 28px;margin-left: 10px">
                            <Col span='11'>
                                <FormItem label='录入人：' prop="createUserName">
                                    <Input v-model="InputData.createUserName" disabled/>
                                </FormItem>
                            </Col>
                            <Col span='11' offset="1">
                                <FormItem label='录入人电话：' prop="registrantPhone">
                                    <Input v-model="InputData.registrantPhone"/>
                                </FormItem>
                            </Col>
                        </Row>
                    </div>
                    <!--<div v-show="modaleshow==2">-->
                        <!--<br/>-->
                      <!--<Row>-->
                        <!--<Col span="24">-->
                          <!--<div style="margin-left:10%;width: 81%">-->
                            <!--<Upload ref="upload"-->
                                    <!--:before-upload="beforeUpload"-->
                                    <!--:show-upload-list="true"-->
                                    <!--:max-size="10240"-->
                                    <!--multiple-->
                                    <!--type="drag"-->
                                    <!--:action="fileUrl">-->
                              <!--<div style="padding: 20px">-->
                                <!--<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>-->
                                <!--<p>点击将文件拖拽到这里上传</p>-->
                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                              <!--</div>-->
                            <!--</Upload>-->
                          <!--</div>-->
                          <!--<FormItem style="margin-left: 70px" label="附件：" v-show="uploadList2.length>0">-->
                            <!--<div v-for="item in uploadList2" :key='item'>-->
                              <!--<a @click="downloadFile(InputData.bookId,item)">{{ item.fileName }}</a>-->
                              <!--<Button type="text" icon="md-trash" @click="remove1(item.id,modaleshow)"-->
                                      <!--style="margin-left: 20px;margin-bottom: 3px"/>-->
                            <!--</div>-->
                          <!--</FormItem>-->
                        <!--</Col>-->
                      <!--</Row>-->

                    <!--</div>-->
                    <!--<div v-show="modaleshow==3">-->
                        <!--<br/>-->
                      <!--<Row>-->
                        <!--<Col span="24">-->

                          <!--<div style="margin-left:10%;width: 81%">-->
                            <!--<Upload ref="upload"-->
                                    <!--:before-upload="beforeUpload"-->
                                    <!--:show-upload-list="true"-->
                                    <!--:max-size="10240"-->
                                    <!--multiple-->
                                    <!--type="drag"-->
                                    <!--:action="fileUrl+'/'+InputData.bookId+'/files/picture/idCard'">-->
                              <!--<div style="padding: 20px">-->
                                <!--<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>-->
                                <!--<p>点击将文件拖拽到这里上传</p>-->
                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                              <!--</div>-->
                            <!--</Upload>-->
                          <!--</div>-->
                          <!--<FormItem style="margin-left: 70px" label="附件：" v-show="uploadList3.length>0">-->
                            <!--<div v-for="item in uploadList3" :key='item'>-->
                              <!--<a @click="downloadFile(InputData.bookId,item)">{{ item.fileName }}</a>-->
                              <!--<Button type="text" icon="md-trash" @click="remove1(item.id,modaleshow)"-->
                                      <!--style="margin-left: 20px;margin-bottom: 3px"/>-->
                            <!--</div>-->
                          <!--</FormItem>-->
                        <!--</Col>-->
                      <!--</Row>-->

                    <!--</div>-->
                    <!--<div v-show="modaleshow==4">-->
                        <!--<br/>-->
                      <!--<Row>-->
                        <!--<Col span="24">-->
                          <!--<div style="margin-left:10%;width: 81%">-->
                            <!--<Upload ref="upload"-->
                                    <!--:before-upload="beforeUpload"-->
                                    <!--:show-upload-list="true"-->
                                    <!--:max-size="10240"-->
                                    <!--multiple-->
                                    <!--type="drag"-->
                                    <!--:action="fileUrl+'/'+InputData.bookId+'/files/userFile/lnsurance'">-->
                              <!--<div style="padding: 20px">-->
                                <!--<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>-->
                                <!--<p>点击将文件拖拽到这里上传</p>-->
                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                              <!--</div>-->
                            <!--</Upload>-->
                          <!--</div>-->
                          <!--<FormItem style="margin-left: 70px" label="附件：" v-show="uploadList4.length>0">-->
                            <!--<div v-for="item in uploadList4" :key='item'>-->
                              <!--<a @click="downloadFile(InputData.bookId,item)">{{ item.fileName }}</a>-->
                              <!--<Button type="text" icon="md-trash" @click="remove1(item.id,modaleshow)"-->
                                      <!--style="margin-left: 5px;margin-bottom: 3px"/>-->
                            <!--</div>-->
                          <!--</FormItem>-->
                        <!--</Col>-->
                      <!--</Row>-->

                    <!--</div>-->
                    <!--<div v-show="modaleshow==5">-->
                        <!--<br/>-->
                      <!--<Row>-->
                        <!--<Col span="24">-->
                          <!--<div style="margin-left:10%;width: 81%">-->
                            <!--<Upload ref="upload"-->
                                    <!--:before-upload="beforeUpload"-->
                                    <!--:show-upload-list="true"-->
                                    <!--:max-size="10240"-->
                                    <!--multiple-->
                                    <!--type="drag"-->
                                    <!--:action="fileUrl+'/'+InputData.bookId+'/files/userFile/certificate'">-->
                              <!--<div style="padding: 20px">-->
                                <!--<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>-->
                                <!--<p>点击将文件拖拽到这里上传</p>-->
                                <!--<span style="font-size:8px;color: #797a64">支持扩展名：.rar .zip .doc .docx .pdf...</span>-->
                              <!--</div>-->
                            <!--</Upload>-->
                          <!--</div>-->
                          <!--<FormItem style="margin-left: 70px" label="附件：" v-show="uploadList5.length>0">-->
                            <!--<div v-for="item in uploadList5" :key='item'>-->
                              <!--<a @click="downloadFile(InputData.bookId,item)">{{ item.fileName }}</a>-->
                              <!--<Button type="text" icon="md-trash" @click="remove1(item.id,modaleshow)"-->
                                      <!--style="margin-left: 5px;margin-bottom: 3px"/>-->
                            <!--</div>-->
                          <!--</FormItem>-->
                        <!--</Col>-->
                      <!--</Row>-->

                    <!--</div>-->

                </Form>
            </div>
            <div slot="footer">
                <Button class='ivu-btn-save' :loading="buttonLoading" @click="submit('InputData')">确定</Button>
                <Button class='ivu-btn-cancel' @click="onCancel">取消</Button>
                <!--<Button class='ivu-btn-cancel' v-show="modaleshow!==5" @click="spitTo('InputData')">下一步</Button>-->
                <!--<Button class='ivu-btn-cancel' v-show="modaleshow!==1" @click="modaleshow&#45;&#45;">上一步</Button>-->
            </div>
        </Modal>

        <Modal v-model="model2" :width=800 footer-hide title="相关方库">
            <Form ref="pageModel2" :model="pageModel2" :label-width="120">
                <Row class="query-form">
                    <Col span="8">
                        <FormItem label="相关方名称：">
                            <Input type="text" v-model="pageModel2.contractorName"/>
                        </FormItem>
                    </Col>
                    <Col span="16">
                        <Button size="large" class="ivu-btn-reset" icon="md-add" @click="modelAccount=true,AccountData={}">新增</Button>
                        <Button @click="reseter" class="ivu-btn-reset">重置</Button>
                        <Button class="ivu-btn-query" icon="md-search" @click="selectContractorQuery()">查询</Button>
                    </Col>
                </Row>
                <Row>
                    <Col span="24">
                        <Table height="300" :loading="loading1" size="small" no-data-text="没有查询到相关数据!"
                               @on-row-dblclick="danxuan"
                               highlight-row stripe border :columns="columns2" width="100%" :data="contractor">
                        </Table>
                    </Col>
                </Row>
                <Row style="margin-right:10px;">
                    <Col span="24">
                        <Page :total="pageModel2.total" :page-size="pageModel2.pageSize" @on-change="pageChange1"
                              style="float: right" @on-page-size-change="pageSizeChange1"
                              :page-size-opts="pageSizeArray"
                              show-total show-sizer show-elevator/>
                    </Col>
                </Row>
            </Form>
        </Modal>

        <Modal :transfer=false v-model="model3" :width=800 @on-cancel="onCancel">
            <p>
                <span>相关方基本信息 </span>
            </p>
            <div>
                <!--<Menu mode="horizontal" @on-select='lowerStep' :active-name="modaleshow">-->
                    <!--<MenuItem :name="1">相关方基本信息</MenuItem>-->
                    <!--<MenuItem :name="2">人员信息</MenuItem>-->
                    <!--<MenuItem :name="3">人员资质证书</MenuItem>-->
                    <!--<MenuItem :name="4">安全环保协议</MenuItem>-->
                    <!--<MenuItem :name="5">其它</MenuItem>-->
                <!--</Menu>-->
                <Form :model="InputData" label-position="top">
                    <!--:label-width="120"-->
                    <div v-if="modaleshow==1">
                        <br/>
                        <Row style="line-height: 42px;margin-left: 10px">
                            <Col span='11'>
                                <span>所属单位：{{InputData.companyName}}</span>
                            </Col>
                            <Col span='11' offset="1">
                                <span>相关方名称：{{InputData.contractorName}}</span>
                            </Col>

                        </Row>
                        <Row style="line-height: 42px;margin-left: 10px" class="detail-background-clor">
                            <Col span='11' >
                                <span>类别：{{InputData.categoryName}}</span>
                            </Col>
                            <Col span='11' offset="1">
                                <span>法定代表人：{{InputData.legalPerson}}</span>
                            </Col>
                        </Row>
                       <!-- <Row  style="line-height: 42px;margin-left: 10px" >
                            <Col span='11' >
                                <span>特种作业人员上岗证数量：{{InputData.workLicenseNumber}}</span>
                            </Col>
                            <Col span='11'  offset="1">
                                <span>特种作业人员数量：{{InputData.workerNumber}}</span>
                            </Col>
                        </Row> -->
                        <Row  style="line-height: 42px;margin-left: 10px" class="detail-background-clor">
                            <Col span='11' >
                                <span>相关方负责人：{{InputData.constructionDirector}}</span>
                            </Col>
                            <Col span='11' offset="1">
                                <span>相关方负责人电话：{{InputData.constructionDirectorPhone}}</span>
                            </Col>
                        </Row>
                        <Row  style="line-height: 42px;margin-left: 10px" >
                            <Col span='11' >
                                <span>相关方单位安全员：{{InputData.safetyOfficer}}</span>
                            </Col>
                            <Col span='11' offset="1">
                                <span>相关方单位安全员电话：{{InputData.safetyOfficerPhone}}</span>
                            </Col>
                        </Row>
                        <Row  style="line-height: 42px;margin-left: 10px" >
                            <Col span='11'>
                                <span>合作期限：{{InputData.cooperationTerm}}</span>
                            </Col>
                        </Row>
                        <Row style="line-height: 42px;margin-left: 10px">
                            <Col span="24">
                                <FormItem label="资质文件：" v-show="uploadList5.length>0">
                                    <div v-for="item in uploadList5" :key='item'>
                                        <a @click="downloadFile(InputData.bookId,item)">{{ item.fileName }}
                                        </a>
                                    </div>
                                </FormItem>
                            </Col>
                        </Row>

                        <Row  style="line-height: 42px;margin-left: 10px" >
                            <Col span='11' >
                                <span>录入人：{{InputData.createUserName}}</span>
                            </Col>
                            <Col span='11' offset="1">
                                <span>录入人电话：{{InputData.registrantPhone}}</span>
                            </Col>
                        </Row>
                    </div>
                    <!--<div v-if="modaleshow==2">-->
                      <!--<br>-->
                      <!--<Row style="margin-left: 10px" >-->
                        <!--<Col span="24">-->
                          <!--<FormItem  style="margin-left: 80px" label="附件：" v-show="uploadList2.length>0">-->
                            <!--<div v-for="item in uploadList2" :key='item'>-->
                              <!--<a @click="downloadFile(InputData.bookId,item)">{{ item.fileName }}-->
                              <!--</a>-->
                            <!--</div>-->
                          <!--</FormItem>-->
                        <!--</Col>-->
                      <!--</Row>-->
                    <!--</div>-->
                    <!--<div v-if="modaleshow==3"  >-->
                      <!--<br>-->
                      <!--<Row style="margin-left: 10px">-->
                        <!--<Col span="24">-->
                          <!--<FormItem style="margin-left: 80px" label="附件：" v-show="uploadList3.length>0">-->
                            <!--<div v-for="item in uploadList3" :key='item'>-->
                              <!--<a @click="downloadFile(InputData.bookId,item)">{{ item.fileName }}</a>-->


                            <!--</div>-->
                          <!--</FormItem>-->
                        <!--</Col>-->
                      <!--</Row>-->
                    <!--</div>-->
                    <!--<div v-if="modaleshow==4"  >-->
                      <!--<br>-->
                      <!--<Row style="margin-left: 10px">-->
                        <!--<Col span="24">-->
                          <!--<FormItem style="margin-left: 80px"  label="附件：" v-show="uploadList4.length>0">-->
                            <!--<div v-for="item in uploadList4" :key='item'>-->
                              <!--<a @click="downloadFile(InputData.bookId,item)">{{ item.fileName }}-->
                              <!--</a>-->
                            <!--</div>-->
                          <!--</FormItem>-->
                        <!--</Col>-->
                      <!--</Row>-->
                    <!--</div>-->
                    <!--<div v-if="modaleshow==5" >-->
                      <!--<br>-->
                      <!--<Row style="margin-left: 10px">-->
                        <!--<Col span="24">-->
                          <!--<FormItem style="margin-left: 70px" label="附件：" v-show="uploadList5.length>0">-->
                            <!--<div v-for="item in uploadList5" :key='item'>-->
                              <!--<a @click="downloadFile(InputData.bookId,item)">{{ item.fileName }}-->
                              <!--</a>-->
                            <!--</div>-->
                          <!--</FormItem>-->
                        <!--</Col>-->
                      <!--</Row>-->

                    <!--</div>-->
                </Form>
            </div>
            <div slot="footer">
                <Button class='ivu-btn-save' @click="onCancel">关闭</Button>
            </div>
        </Modal>

        <Modal :transfer=false v-model="modelAccount" :width=700 title='相关方信息' @on-cancel="onCancel">
            <Form ref='AccountData' :model="AccountData" :rules="ruleCustom1" label-position="top">
                <Row style="line-height: 28px;margin-left: 15px">
                    <Col span='23'>
                        <FormItem label='企业名称：' prop="contractorName">
                            <Input v-model="AccountData.contractorName"/>
                        </FormItem>
                    </Col>
                    <Col span='11'>
                        <FormItem label='经营范围：'>
                            <Input v-model="AccountData.bizRangeName"/>
                        </FormItem>
                    </Col>
                    <Col span='11' offset="1">
                        <FormItem label='企业性质：' prop="propertyName">
                            <Input v-model="AccountData.propertyName"/>
                        </FormItem>
                    </Col>
                    <Col span='11'>
                        <FormItem label='法定代表人：' prop="legalPerson">
                            <Input v-model="AccountData.legalPerson"/>
                        </FormItem>
                    </Col>
                    <Col span='11' offset="1">
                        <FormItem label='注册资本：' prop="capital">
                            <Input v-model="AccountData.capital"/>
                        </FormItem>
                    </Col>
                    <Col span='11'>
                        <FormItem label='统一社会信用代码：' prop="unifyCode">
                            <Input v-model="AccountData.unifyCode"/>
                        </FormItem>
                    </Col>
                    <Col span='11' offset="1">
                        <FormItem label='客商类型：'>
                            <Input v-model="AccountData.customerType"/>
                        </FormItem>
                    </Col>
                    <Col span='11'>
                        <FormItem label='行业分类：'>
                            <Input v-model="AccountData.industryCategory"/>
                        </FormItem>
                    </Col>
                    <Col span='11' offset="1">
                        <FormItem label='客商状态：'>
                            <Input v-model="AccountData.customerStatus"/>
                        </FormItem>
                    </Col>
                    <Col span='11'>
                        <FormItem label='客商资质：'>
                            <Input v-model="AccountData.customerQualifications"/>
                        </FormItem>
                    </Col>
                    <Col span='11' offset="1">
                        <FormItem label='资质状态：'>
                            <Select v-model="AccountData.qualificationStatus">
                                <Option value="1">有效</Option>
                                <Option value="2">无效</Option>
                            </Select>
                            <!--<Input v-model="InputData.qualificationStatus"/>-->
                        </FormItem>
                    </Col>
                </Row>
            </Form>
            <div slot="footer">
                <Button class='ivu-btn-save' :loading="buttonLoading" @click="submitAccount('AccountData')">确定</Button>
                <Button class='ivu-btn-cancel' @click="onCancel">取消</Button>
            </div>
        </Modal>

    </Layout>
</template>

<script>
import {Api} from '../../../api/index.js'
import {sessionStorage} from '../../../common/cacheUtils.js';
import cascaderDom from '../../../components/cascader-dom.vue';

export default {
         props: ['companyId', 'modelSelect'],
        components: {cascaderDom},
        name: "interestedPartiesUser",
        data() {
            return {
                currentUser: JSON.parse(sessionStorage('userId').get('userId')),
                exportUrl: Api.interestedPartiesEvaluateBookList+ '/export',
                tableHeight: '',
                switchFlag: false,
                loading: false,
                form1: {
                    staffName: '',
                    contractorName: '',
                    orgId: '',
                    orgName: ''
                },
                loading1:false,
                pageSizeArray: [10, 20, 50],
                pagedata: {
                    total: 0,
                    pageSize: 10,
                    currentPage: 1,
                },
                fileUrl: Api.interestedPartiesUserFile,
                dataTable: [],
                ruleCustom: {
                    companyId:[ { required: true, message: ' ', trigger: 'change' } ],
                    category:[ { required: true, message: ' ', trigger: 'change' } ],
                    cooperationTerm:[ { required: true, message: ' ', trigger: 'change' } ],
                    accountId: [{
                        validator: (rule, value, callback) => {
                            if (this.InputData.accountId == null || this.InputData.accountId == '' || this.InputData.accountId == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    workLicenseNumber: [ { pattern: /^([0-9][0-9]*)?$/, required: true, message: ' ', trigger: 'change',type:'number'}],
                    workerNumber: [ { pattern: /^([0-9][0-9]*)?$/, required: true, message: ' ', trigger: 'change',type:'number'}],
                    constructionDirector: [{
                        validator: (rule, value, callback) => {
                            if (this.InputData.constructionDirector == null || this.InputData.constructionDirector == '' || this.InputData.constructionDirector == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    constructionDirectorPhone: [{
                        validator: (rule, value, callback) => {
                            if(!(/^1[3456789]\d{9}$/.test(this.InputData.constructionDirectorPhone))){
                                callback(' ');
                                // this.$Message.error("请填写有效的的手机号")
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'blur'
                    }],
                    safetyOfficer: [{
                        validator: (rule, value, callback) => {
                            if (this.InputData.safetyOfficer == null || this.InputData.safetyOfficer == '' || this.InputData.safetyOfficer == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    safetyOfficerPhone: [{
                        validator: (rule, value, callback) => {
                            if(!(/^1[3456789]\d{9}$/.test(this.InputData.safetyOfficerPhone))){
                                callback(' ');
                                // this.$Message.error("请填写有效的的手机号")
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'blur'
                    }],
                    registrantPhone: [{
                        validator: (rule, value, callback) => {
                            if(!(/^1[3456789]\d{9}$/.test(this.InputData.registrantPhone))){
                                callback(' ');
                                // this.$Message.error("请填写有效的的手机号")
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'blur'
                    }],
                },
                show: true,
                columns1: [
                    {title: "序号", width: 80, align: "center", fixed: 'left',
                        render: (h, params) => {return h('span', params.index + (this.pagedata.currentPage - 1) * this.pagedata.pageSize + 1);}},
                    {minWidth: 150, title: '所属单位', align: 'center', key: 'companyName',},
                    {minWidth: 150, title: '相关方名称', align: 'center', key: 'contractorName',},
                    {minWidth: 120, title: '类别', align: 'center', key: 'categoryName',},
                    {minWidth: 100, title: '合作期限', align: 'center', key: 'cooperationTerm',},
                    {minWidth: 110, title: '法定代表人', align: 'center', key: 'legalPerson',},
                    // {minWidth: 150, title: '特种作业人员上岗证数量', align: 'center', key: 'workLicenseNumber',},
                    // {minWidth: 150, title: '特种作业人员数量', align: 'center', key: 'workerNumber',},
                    {minWidth: 150, title: '相关方负责人', align: 'center', key: 'constructionDirector',},
                    {minWidth: 150, title: '相关方负责人电话', align: 'center', key: 'constructionDirectorPhone',},
                    {minWidth: 150, title: '相关方单位安全员', align: 'center', key: 'safetyOfficer',},
                    {minWidth: 150, title: '相关方单位安全员电话', align: 'center', key: 'safetyOfficerPhone',},
                    {minWidth: 150, title: '录入人', align: 'center', key: 'createUserName',},
                    {minWidth: 150, title: '录入人手机号', align: 'center', key: 'registrantPhone',},
                    {title: '操作', key: 'action', fixed: 'right',
                        width: this.modelSelect ? 80 : 200,
                        align: 'center',
                        render: (h, params) => {
                            if (this.modelSelect) {
                                return h('div', [
                                    h('A', {
                                        props: {type: 'primary', size: 'small'},
                                        style: {fontSize: '12px'},
                                        on: {
                                            click: () => {
                                                // this.checkSave(params.row);
                                                this.$emit('getSelectModelData',params.row);
                                            }
                                        }
                                    }, '选择'),
                                ]);
                            } else {
                                if (this.currentUser.loginId === this.Common.admin || this.currentUser.userId === params.row.createUserId || sessionStorage('userId').getObject('userId').userRole.find(obj => obj.roleId == '73b38b37dff64392ba0ee7dd579bf293') != undefined
                                    ||sessionStorage('userId').getObject('userId').userBeHandedOver.find(obj => obj == params.row.createUserId) != undefined) {
                                    return h('div', [
                                        h('A', {
                                            props: {
                                                type: 'primary',
                                                size: 'small'
                                            },
                                            style: {
                                                fontSize: '14px',
                                            },
                                            on: {
                                                click: () => {
                                                    this.uploadList5 =[]
                                                    this.InputData = params.row;
                                                    this.model3 = true;
                                                    setTimeout(() => {
                                                        this.lowerStep(1)
                                                    }, 0)
                                                }
                                            }
                                        }, '详情'),
                                        h('Divider', {
                                            props: {
                                                type: 'vertical',
                                            }
                                        }, ''),
                                        h('A', {
                                            props: {
                                                type: 'primary',
                                                size: 'small'
                                            },
                                            style: {
                                                fontSize: '14px',
                                                color: (params.row.createUserId == sessionStorage('userId').getObject('userId').userId ||  this.Common.userIdList.includes(sessionStorage('userId').getObject('userId').userId )||sessionStorage('userId').getObject('userId').userRole.find(obj => obj.roleId == '73b38b37dff64392ba0ee7dd579bf293') != undefined
                                                    ||sessionStorage('userId').getObject('userId').userBeHandedOver.find(obj => obj == params.row.createUserId) != undefined)? '':'#d0d0d0' ,
                                                pointerEvents: (params.row.createUserId == sessionStorage('userId').getObject('userId').userId ||  this.Common.userIdList.includes(sessionStorage('userId').getObject('userId').userId )||sessionStorage('userId').getObject('userId').userRole.find(obj => obj.roleId == '73b38b37dff64392ba0ee7dd579bf293') != undefined
                                                    ||sessionStorage('userId').getObject('userId').userBeHandedOver.find(obj => obj == params.row.createUserId) != undefined) ? '' : 'none'
                                            },
                                            on: {
                                                click: () => {
                                                    this.modaleshow = 1
                                                    this.uploadList5 =[]
                                                    this.InputData = JSON.parse(JSON.stringify(params.row));
                                                    this.InputData.workLicenseNumber = (params.row.workLicenseNumber==null ||params.row.workLicenseNumber=='')?0:parseInt(params.row.workLicenseNumber)
                                                    this.InputData.workerNumber = (params.row.workerNumber==null ||params.row.workerNumber=='')?0:parseInt(params.row.workerNumber)
                                                    this.InputData.companyName = params.row.companyName
                                                    this.InputData.companyId = params.row.companyId
                                                    this.model1 = true;
                                                    this.add = false
                                                    this.show = false;
                                                    setTimeout(() => {
                                                        this.lowerStep(1)
                                                        this.show = true
                                                    }, 0)
                                                }
                                            }
                                        }, '修改'),
                                        h('Divider', {
                                            props: {
                                                type: 'vertical',
                                            }
                                        }, ''),
                                        h('A', {
                                            props: {
                                                type: 'error',
                                                size: 'small'
                                            },
                                            style: {
                                                fontSize: '14px',
                                                color: (params.row.createUserId == sessionStorage('userId').getObject('userId').userId ||  this.Common.userIdList.includes(sessionStorage('userId').getObject('userId').userId )||sessionStorage('userId').getObject('userId').userRole.find(obj => obj.roleId == '73b38b37dff64392ba0ee7dd579bf293') != undefined
                                                    ||sessionStorage('userId').getObject('userId').userBeHandedOver.find(obj => obj == params.row.createUserId) != undefined)? 'red':'#d0d0d0' ,
                                                pointerEvents: (params.row.createUserId == sessionStorage('userId').getObject('userId').userId ||  this.Common.userIdList.includes(sessionStorage('userId').getObject('userId').userId )||sessionStorage('userId').getObject('userId').userRole.find(obj => obj.roleId == '73b38b37dff64392ba0ee7dd579bf293') != undefined
                                                    ||sessionStorage('userId').getObject('userId').userBeHandedOver.find(obj => obj == params.row.createUserId) != undefined) ? '' : 'none'
                                            },
                                            on: {
                                                click: () => {
                                                    this.$Modal.confirm({
                                                        title: '提示',
                                                        content: '<p>是否要删除？</p>',
                                                        onOk: () => {
                                                            this.deleteData(params.row);
                                                        },
                                                        onCancel: () => {
                                                        }
                                                    });


                                                }
                                            }
                                        }, '删除')
                                    ]);
                                }else{
                                    return h('div', [
                                        h('A', {
                                            props: {
                                                type: 'primary',
                                                size: 'small'
                                            },
                                            style: {
                                                fontSize: '14px',
                                            },
                                            on: {
                                                click: () => {
                                                    this.InputData = params.row;
                                                    this.model3 = true;
                                                }
                                            }
                                        }, '详情'),
                                        h('Divider', {
                                            props: {
                                                type: 'vertical',
                                            }
                                        }, ''),
                                        h('A', {
                                            props: {type: 'primary', size: 'small'},
                                            style: {fontSize: '14px', color: '#c5c8ce'}
                                        }, '修改'),
                                        h('Divider', {
                                            props: {
                                                type: 'vertical',
                                            }
                                        }, ''),
                                        h('A', {
                                            props: {type: 'primary', size: 'small'},
                                            style: {fontSize: '14px', color: '#c5c8ce'}
                                        }, '删除')
                                    ]);
                                }
                            }
                        }
                    }
                ],
                startDate: '',
                endDate: '',
                add: false,
                model1: false,
                model2: false,
                model3: false,
                InputData: {
                    workLicenseNumber:0,
                    workerNumber:0,
                },
                categorys:[],
                cooperationTerms:[
                    '长期',
                    '阶段性'
                ],
                modaleshow: '1',
                buttonLoading: false,
                uploadList: [],
                uploadList2: [],
                uploadList3: [],
                uploadList4: [],
                uploadList5: [],

                pageModel2: {
                    total: 0,
                    pageSize: 10,
                    currentPage: 1,
                    contractorName: ''
                },
                contractor: [],
                columns2: [
                    {
                        title: "序号",
                        width: 80,
                        align: "center",
                        fixed: 'left',
                        render: (h, params) => {
                            return h('span', params.index + (this.pageModel2.currentPage - 1) * this.pageModel2.pageSize + 1);
                        }
                    },
                    {
                        minWidth: 150,
                        title: '相关方名称',
                        align: 'center',
                        key: 'contractorName',
                    },
                    {
                        minWidth: 150,
                        title: '法定代表人',
                        align: 'center',
                        key: 'legalPerson',
                    },
                    {
                        minWidth: 150,
                        title: '注册资本',
                        align: 'center',
                        key: 'capital',
                    },
                    {
                        minWidth: 150,
                        title: '统一社会信用代码',
                        align: 'center',
                        key: 'unifyCode',
                    },
                    {
                        title: '操作',
                        key: 'action',
                        fixed: 'right',
                        width: 80,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('A', {
                                    props: {type: 'primary', size: 'small'},
                                    style: {fontSize: '12px'},
                                    on: {
                                        click: () => {
                                            this.danxuan(params.row);
                                        }
                                    }
                                }, '选择'),
                            ]);
                        }
                    }
                ],
                modelAccount: false,
                AccountData:{},
                ruleCustom1: {
                    contractorName: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],

                    legalPerson: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    capital: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    unifyCode: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    propertyName: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    headUnit: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    headUnitPhone: [{
                        validator: (rule, value, callback) => {
                            let reg = /^1[0-9]{10}$/;
                            if (value === '' || value === undefined || value == null) {
                                callback(' ')
                            } else {
                                if (reg.test(value)) {
                                    callback();
                                } else {
                                    callback(' ');
                                }
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    workLicenseNumber: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else if (value < 0) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    workerNumber: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else if (value < 0) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    constructionDirector: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    constructionDirectorPhone: [{
                        validator: (rule, value, callback) => {
                            let reg = /^1[0-9]{10}$/;
                            if (value === '' || value === undefined || value == null) {
                                callback(' ')
                            } else {
                                if (reg.test(value)) {
                                    callback();
                                } else {
                                    callback(' ');
                                }
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    safetyOfficer: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    safetyOfficerPhone: [{
                        validator: (rule, value, callback) => {
                            let reg = /^1[0-9]{10}$/;
                            if (value === '' || value === undefined || value == null) {
                                callback(' ')
                            } else {
                                if (reg.test(value)) {
                                    callback();
                                } else {
                                    callback(' ');
                                }
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    qualificationStatus: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],

                    bizRangeName: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    customerType: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    industryCategory: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    customerStatus: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                    customerQualifications: [{
                        validator: (rule, value, callback) => {
                            if (value == null || value == '' || value == undefined) {
                                callback(' ')
                            } else {
                                callback()
                            }
                        },
                        required: true,
                        trigger: 'change'
                    }],
                },
            }
        },
        mounted() {
            this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 145;
            this.query()
            let _this = this
            this.gDic(Api.queryCodeDetailBySortId + "/inter-00001", function (result) {
                _this.categorys = result;
            });
        },
        methods: {

            submitAccount(name) {
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        this.buttonLoading = true
                        let url = Api.interestedPartiesAccountAdd
                        this.$http.post(url, this.AccountData).then((res) => {
                            if (res.data.status === 200) {
                                this.buttonLoading = false
                                this.modelAccount = false

                                let account = res.data.data
                                this.InputData.accountId = account.contractorId
                                this.InputData.contractorName = account.contractorName
                                this.InputData.propertyName = account.propertyName
                                this.InputData.legalPerson = account.legalPerson
                                this.InputData.capital = account.capital
                                this.InputData.unifyCode = account.unifyCode
                                this.model2 = false
                                this.model1 = true

                            } else if (res.data.status === 201) {
                                this.$Message.error(res.data.msg);
                            }
                        }).catch(e => {
                            this.$Message.error('请求失败');
                        })
                    } else {
                        this.$Message.error('请填报完整!');
                    }
                })

            },

            setCompanyId(data){
                this.InputData.companyId = data[data.length - 1];
            },
            setCompanyName(data){
                this.InputData.companyName = data;
            },
            reseter(){
                this.pageModel2.contractorName = "";
                this.pageModel2.currentPage = 1;
                this.selectContractor();
            },
            danxuan(row, index) {
                this.InputData.accountId = row.contractorId
                this.InputData.contractorName = row.contractorName
                this.InputData.propertyName = row.propertyName
                this.InputData.legalPerson = row.legalPerson
                this.InputData.capital = row.capital
                this.InputData.unifyCode = row.unifyCode
                this.model2 = false
                this.model1 = true
            },
            selectContractorQuery(){
                this.pageModel2.currentPage = 1;
                this.selectContractor();
            },
            isTrueModel2(){
              this.pageModel2.contractorName = null;
              this.model2 = true;
              this.selectContractor();
            },
            selectContractor() {
                this.loading1 = true
                this.contractor = []
                let data = {
                    startPage: this.pageModel2.currentPage,
                    size: this.pageModel2.pageSize,
                    contractorName: this.pageModel2.contractorName
                }
                data = Object.assign(data);
                let url = Api.interestedPartiesAccountList
                this.$http.get(url, {params: data}).then((res) => {
                    console.log(res.data);
                    this.contractor = res.data.data.data;
                    this.pageModel2.total = res.data.data.totalSize;
                    this.loading1 = false;
                }).catch(e => {
                    this.loading1 = false;
                    this.$Message.error("数据获取失败")
                })
            },


            downloadFile(id, file) {
                let url = this.fileUrl + '/file/' + file.id;
                this.$http.get(url, {
                    responseType: 'blob'      //告诉服务器我们需要的响应格式
                }).then((res) => {
                    console.log(res)
                    const aLink = document.createElement("a");
                    let blob = new Blob([res.data], {
                        type: res.bodyBlob.type      //将会被放入到blob中的数组内容的MIME类型
                    });
                    aLink.href = URL.createObjectURL(blob)
                    aLink.download = file.fileName //标题
                    aLink.click()
                    document.body.appendChild(aLink)
                })
            },
            remove1(id, name) {
                console.log(id)
                let url = this.fileUrl + '/file/' + id;
                this.$http.delete(url).then((res) => {
                    this.lowerStep(name)
                })
            },
            onCancel() {
                this.modelAccount = false
                this.AccountData = {}
                this.InputData = {}
                this.modaleshow = '1'
                this.model1 = false
                this.model3 = false
                this.query()
            },

            beforeUpload(file) {
                let url = ''
                let formData = new FormData();
                formData.append("files", file); // 文件对象
                // if (this.modaleshow == 2) {
                //     url = this.fileUrl + '/' + this.InputData.bookId + '/files/userFile/staff'
                //     console.log(url)
                // } else if (this.modaleshow == 3) {
                //     url = this.fileUrl + '/' + this.InputData.bookId + '/files/userFile/QFile'
                // } else if (this.modaleshow == 4) {
                //     url = this.fileUrl + '/' + this.InputData.bookId + '/files/userFile/SaEnFile'
                // } else if (this.modaleshow == 5) {
                    url = this.fileUrl + '/' + this.InputData.bookId + '/files/userFile/other'
                // }
                this.$http.post(url, formData).then((res) => {
                    if (res.data.result == "success") {
                        this.$Message.info("文件上传成功")
                        this.lowerStep(this.modaleshow)
                    }
                })
                return false
            },
            lowerStep(name) {
                this.uploadList = []
                let url = ''
                let field = ''
                // if (name == 2) {
                //     url = this.fileUrl + '/' + this.InputData.bookId + '/files/userFile' //
                //     field = 'staff'
                // } else if (name == 3) {
                //     url = this.fileUrl + '/' + this.InputData.bookId + '/files/userFile' //idCard
                //     field = 'QFile'
                // } else if (name == 4) {
                //     url = this.fileUrl + '/' + this.InputData.bookId + '/files/userFile' //lnsurance
                //     field = 'SaEnFile'
                // } else if (name == 5) {
                    url = this.fileUrl + '/' + this.InputData.bookId + '/files/userFile' //certificate
                    field = 'other'
                // }
                this.$http.get(url + "?field=" + field).then((res) => {
                    if (res.data.result == "success") {
                        console.log(res.data)
                        // if (name == '2') {
                        //     this.uploadList2 = res.data.data
                        // } else if (name == '3') {
                        //     this.uploadList3 = res.data.data
                        // } else if (name == '4') {
                        //     this.uploadList4 = res.data.data
                        // } else if (name == '5') {
                            this.uploadList5 = res.data.data
                        // }
                    }
                })
                this.modaleshow = name
            },
            spitTo(name){
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        this.modaleshow++
                    }else {
                        this.$Message.error('请填报完整!');
                    }
                })
            },
            submit(name) {
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        this.buttonLoading = true
                        if (this.add) {
                            let url = Api.interestedPartiesEvaluateBookAdd
                            this.InputData.bsflag = '0'
                            this.InputData.createOrgId = this.currentUser.orgInfo.orgId
                            this.InputData.createUserId = this.currentUser.userId
                            this.$http.post(url, this.InputData).then((res) => {
                                this.buttonLoading = false
                                if (res.data.status == 200) {
                                    this.$Message.success('成功');
                                    this.query()
                                    this.model1 = false
                                }else if (res.data.status == 202){
                                    this.$Message.error(res.data.msg);
                                }

                            }).catch(e => {
                                this.$Message.error('请求失败');
                            })
                        } else {
                            let url = Api.interestedPartiesEvaluateBookUpdate;
                            this.InputData.updateUserId = this.currentUser.userId
                            this.InputData.updateOrgId = this.currentUser.orgInfo.orgId
                            this.$http.post(url, this.InputData).then((res) => {
                                this.$Message.success('成功');
                                this.buttonLoading = false
                                this.model1 = false
                                this.query()
                            }).catch(e => {
                                this.$Message.error('请求失败');
                            })
                        }
                    } else {
                        this.$Message.error('请填报完整!');
                    }
                })

            },

            deleteData(row) {
                let url = Api.interestedPartiesEvaluateBookDelete
                let data = {
                    bookId : row.bookId
                }
                this.$http.delete(url, {params: data}).then((res) => {
                    this.$Message.success('成功');
                    this.query()
                }).catch(e => {
                    this.$Message.error("数据获取失败")
                })
            },
            addInfo() {
                this.modaleshow = 1
                this.add = true;
                this.buttonLoading = false
                this.InputData = {
                    bookId: this.get_uuid(),
                    workLicenseNumber:0,
                    workerNumber:0,
                    createUserId: this.currentUser.userId,
                    createUserName: this.currentUser.userName,
                    companyId: this.currentUser.companyId,
                    companyName: this.currentUser.companyName,
                    registrantPhone: this.currentUser.mobileNumber
                };
                this.show = false;
                setTimeout(() => {
                    this.show = true
                }, 0)
                this.model1 = true;
            },
            query() {
                this.loading = true;
                let data = {
                    startPage: this.pagedata.currentPage,
                    size: this.pagedata.pageSize
                }
                if (this.companyId) {
                    this.form1.orgId = this.companyId
                }
                if (this.form1.orgId == '') {
                    this.form1.orgId = this.currentUser.companyId
                }
                data = Object.assign(data, JSON.parse(JSON.stringify(this.form1)));
                let url = Api.interestedPartiesEvaluateBookList
                this.$http.get(url, {params: data}).then((res) => {
                    console.log(res.data);
                    this.dataTable = res.data.data.data;
                    this.pagedata.total = res.data.data.totalSize;
                    this.loading = false;
                }).catch(e => {
                    this.$Message.error("数据获取失败")
                })
            },
            query1() {
                this.pagedata.currentPage =1;
                this.query();
            },
            reset() {
                this.form1 = {
                    staffName: '',
                    contractorName: '',
                    orgId: '',
                    orgName: ''
                }
                if (this.$refs.childOrg) {
                    this.$refs.childOrg.resetCurrentOrg();
                }
                this.pageModel2.currentPage = 1;
                this.pageModel2.contractorName = ''
                this.query();
            },
            switchQuery(flag) {
                this.switchFlag = flag;
                if (!this.switchFlag) {
                    this.tableHeight = this.tableHeight + 44;
                } else {
                    this.tableHeight = this.tableHeight - 44;
                }
            },
            setOrgId(data) {
                this.form1.orgId = data[data.length - 1];
            },
            setOrgName(data) {
                this.form1.companyName = data;
            },
            pageChange1(pageNum) {
                this.pageModel2.currentPage = pageNum;
                this.selectContractor();
            },
            pageSizeChange1(pageSize) {
                this.pageModel2.pageSize = pageSize;
                this.selectContractor();
            },
            get_uuid() {
                let s = [];
                let hexDigits = "0123456789abcdef";
                for (let i = 0; i < 36; i++) {
                    s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
                }
                s[14] = "4";
                s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
                s[8] = s[13] = s[18] = s[23] = "-";

                let uuid = s.join("");
                let reg = new RegExp("-", "g");
                let a = uuid.replace(reg, "");
                console.log(a);
                return a;
            },
            pageChange(pageNum) {
                this.pagedata.currentPage = pageNum;
                this.query();
            },
            pageSizeChange(pageSize) {
                this.pagedata.pageSize = pageSize;
                this.query();
            },
        }
    }
</script>

<style scoped>
    @import '../../../index.css';

</style>
